﻿using CPPEI.Coolzon.Event.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Coolvis.Console.Theme.Windows
{
    /// <summary>
    /// DisplayProxyStatusWindow.xaml 的交互逻辑
    /// </summary>
    public partial class DisplayProxyStatusWindow : Window
    {
        public DisplayProxyStatusWindow()
        {
            InitializeComponent();

            UIEventBus.Register(this);
        }

        protected override void OnClosed(EventArgs e)
        {
            UIEventBus.Unregister(this);

            base.OnClosed(e);
        }

        /// <summary>
        /// 检测网络连接状态
        /// </summary>
        /// <param name="event"></param>
        [CPPEI.Coolzon.Common.Subscribe]
        public void OnReceiveNetStateFeedbackEvent(UINetConnectionStateFeedbackEvent @event)
        {
            this.Dispatcher.Invoke(() =>
            {
                this.dataGridProxyState.ItemsSource = @event.States;
            });
        }
    }
}
